package com.tencent.cloud.iov.recycler.block;

import android.support.v7.widget.RecyclerView;
import android.view.ViewGroup;

import com.tencent.cloud.iov.action.IActionListener;
import com.tencent.cloud.iov.block.IBlockLayout;

/**
 * 区块布局容器
 *
 * 通知区块布局创建视图、绑定区块布局数据及事件
 *
 * @author showxiao
 * @date 2018/3/28
 */

class BlockViewHolder<T> extends RecyclerView.ViewHolder {

    /**
     * 区块布局
     */
    private final IBlockLayout<T> mBlockLayout;

    BlockViewHolder(IBlockLayout<T> blockLayout, ViewGroup parent) {
        super(blockLayout.onCreateView(parent));
        mBlockLayout = blockLayout;
    }

    void onBindView(T item, int position, IActionListener actionListener) {
        mBlockLayout.onBindView(item, position);
        mBlockLayout.onBindAction(item, position, actionListener);
    }
}
